package com.lsu.app.bean;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;

import java.io.Serializable;

import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;

/**
 * 话题
 * @Date 2023-10-18 20:27:15
 * @author hjj
 */
@Data
@TableName("talk")
@ApiModel(value="Talk对象", description="话题")
public class Talk implements Serializable {

    @ApiModelProperty("#id")
    private Integer id;

    @NotBlank(message="[话题标题]不能为空")
    @Size(max= 128,message="编码长度不能超过128")
    @ApiModelProperty("话题标题")
    private String title;

    @NotBlank(message="[话题内容]不能为空")
    @Size(max= 512,message="编码长度不能超过512")
    @ApiModelProperty("话题内容")
    private String content;

    @JsonIgnore  //数据库中不会输出该字段到json中
    @ApiModelProperty("#创建用户id")
    private Integer holdUserId;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("用户头像url")
    private String UserUrl;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("#创建用户昵称")
    private String holdName;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("话题资源图片")
    private String[] imgUrl;

    @ApiModelProperty("#创建时间")
    private String createTime;

    @ApiModelProperty("#热度（点赞数）")
    private Integer heat;

    @ApiModelProperty("#话题类型id")
    @JsonIgnore  //数据库中不会输出该字段到json中
    private Integer type;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("话题类型名称")
    private String typeName;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("#评论数")
    private Integer responds;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("#自身是否点赞（0未点赞，1点赞）")
    private Integer selfLike;

    @ApiModelProperty("课程关联id")
    private Integer courseId;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("评论集合")
    private List<Comment> comments;

    public Talk() {
    }

    public Talk(String title, String content, Integer holdUserId,Integer type,  String createTime) {
        this.title = title;
        this.type=type;
        this.content = content;
        this.holdUserId = holdUserId;
        this.createTime = createTime;
    }

    public Talk(String title, String content, Integer holdUserId, String createTime, Integer type, Integer courseId) {
        this.title = title;
        this.content = content;
        this.holdUserId = holdUserId;
        this.createTime = createTime;
        this.type = type;
        this.courseId = courseId;
    }
}
